let baseUrl =  import.meta.env.VITE_PRODUCTION;
if (process.env.NODE_ENV == 'development') {
	 baseUrl = import.meta.env.VITE_DEV;
} else {
	 baseUrl = import.meta.env.VITE_PRODUCTION;
}
export  const request = (req)=>{
	return new Promise((resolve,reject)=>{
		uni.request({
		    url: baseUrl+req.uri, //仅为示例，并非真实接口地址。
			dataType:'json',
			method:req.method,
		    data:req.method == "get" ? req.params : req.data,
		    header: {
		        'content-type':'application/json',
				'authorization':'Bearer 11|JwtrflcFW5Dr6MoEmuHJDTDBdAxtcKw4gEPcos1t'
		    },
		    success: (res) => {
					if(res.data.data && res.data.code == 200) {
						resolve(res.data.data)
					} else{
						reject(res)
					}
					
		    },
			fail:(err)=>{
				console.log(err)
			}
		});
	})
}
export default request